package com.adingxiong.quickstart.project.service.impl;

import com.adingxiong.quickstart.project.entity.Role;
import com.adingxiong.quickstart.project.mapper.RoleMapper;
import com.adingxiong.quickstart.project.service.IRoleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author xiongc
 * @since 2020-05-21
 */
@Service
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IRoleService {


    @Override
    public HashMap<Integer, String> getNameByIds(List<Integer> ids) {
        HashMap<Integer, String> map = new HashMap<>();
        List<Role> roles =  baseMapper.selectBatchIds(ids);
        if(roles != null){
            for(Role role : roles){
                map.put(role.getId(),role.getName());
            }
        }
        return map;
    }

}
